<template>
    <div>44</div>
</template>

<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import socket from '@/utils/socket'

onMounted(() => {
    
    socket.connect()
})

// socket事件
socket.on("connect", () => {
    console.log("socket connect success")
})
socket.on("message", (message) => {
    console.log("接收到一条消息：", message);
    
    ElNotification({
        title: '提示',
        dangerouslyUseHTMLString: true,
        message: message.data,
        duration: 0,
    })
})
socket.on("error", (error) => {
    console.error("socket连接失败", error);
})
socket.on("disconnect", () => {
    console.log("socket disconnect");
})

onUnmounted(() => {
    socket.disconnect()
})


</script>

<style lang="scss" scoped>

</style>